package com.lxh.lxhcrm.controller.productManagement;

import com.lxh.lxhcrm.model.service.ReplenishService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/chart")
public class ReplenishController {
    @Resource
    ReplenishService replenishService;
    /**
     *
     * @param timeValue
     * @param yearValue
     * @param changeValue
     * @return
     */
    @RequestMapping("/firstChart")
    public List<Map<String,Object>> firstChart(Integer timeValue,String yearValue,Integer changeValue){
        List<Map<String,Object>> newList = new ArrayList();
        if(timeValue == 1 && changeValue == 1){
            /*月度数量统计*/
            System.out.println("用了这方法1");
            newList = replenishService.firstChart(yearValue);
        }else if(timeValue == 1 && changeValue == 2){
            /*月度金额统计*/
            System.out.println("用了这方法2");
            newList = replenishService.firstCharts(yearValue);
        }else if(timeValue == 2 && changeValue == 1){
            /*季度数量统计*/
            System.out.println("用了这方法3");
            newList = replenishService.firstQChart(yearValue);
        }else if(timeValue == 2 && changeValue == 2){
            /*季度金额统计*/
            System.out.println("用了这方法4");
            newList = replenishService.firstQCharts(yearValue);
        }
        return newList;
    }
    /**
     *
     * @param name
     * @param monNum
     * @return
     */
    @RequestMapping("/seccondChart")
    public List<Map<String,Object>> seccondChart(String name,Integer monNum,Integer timeValue,String yearValue,Integer changeValue){
        return replenishService.seccondChart(name,monNum,timeValue,yearValue,changeValue);
    }
}
